﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dblayer;
using Modellayer;

namespace Controllayer
{
    public class PersonCtr
    {
        DbPerson dbP;

        public PersonCtr()
        {
            dbP = new DbPerson();
        }

        public void createEmployee(int phoneNumber, string email, string name, string password, string loginId)
        {
            Person p = new Person();
            p.phoneNumber = phoneNumber;
            p.email = email;
            p.name = name;
            p.password = password;
            p.loginId = loginId;
            p.type = "Employee";

            dbP.createPerson(p);
        }

        public void createCustomer(int phoneNumber, string email, string name, string password)
        {
            Person p = new Person();
            p.phoneNumber = phoneNumber;
            p.email = email;
            p.name = name;
            p.password = password;
            p.type = "Customer";

            dbP.createPerson(p);
        }

        public Person findPerson(int phoneNumber)
        {
            return dbP.findPerson(phoneNumber);
        }

        public void updatePerson(Person p)
        {
            dbP.UpdatePerson(p);
        }
    }
}
